<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>portnetwork_worker2.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="local_closure_goog_messaging_testdata_portnetwork_worker2.js.html">portnetwork_worker2.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2011 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>
<a name="line3"></a>// Use of this source code is governed by the Apache License, Version 2.0.
<a name="line4"></a>// See the COPYING file for details.
<a name="line5"></a>
<a name="line6"></a>/**
<a name="line7"></a> * @fileoverview A web worker for integration testing the PortPool class.
<a name="line8"></a> *
<a name="line9"></a> * @nocompile
<a name="line10"></a> */
<a name="line11"></a>
<a name="line12"></a>self.CLOSURE_BASE_PATH = &#39;../../&#39;;
<a name="line13"></a>importScripts(&#39;../../bootstrap/webworkers.js&#39;);
<a name="line14"></a>importScripts(&#39;../../base.js&#39;);
<a name="line15"></a>
<a name="line16"></a>// The provide is necessary to stop the jscompiler from thinking this is an
<a name="line17"></a>// entry point and adding it into the manifest incorrectly.
<a name="line18"></a>goog.provide(&#39;goog.messaging.testdata.portnetwork_worker2&#39;);
<a name="line19"></a>goog.require(&#39;goog.messaging.PortCaller&#39;);
<a name="line20"></a>goog.require(&#39;goog.messaging.PortChannel&#39;);
<a name="line21"></a>
<a name="line22"></a>function startListening() {
<a name="line23"></a>  var caller = new goog.messaging.PortCaller(
<a name="line24"></a>      new goog.messaging.PortChannel(self));
<a name="line25"></a>
<a name="line26"></a>  caller.dial(&#39;main&#39;).registerService(&#39;sendToFrame&#39;, function(msg) {
<a name="line27"></a>    msg.push(&#39;worker2&#39;);
<a name="line28"></a>    caller.dial(&#39;frame&#39;).send(&#39;sendToWorker1&#39;, msg);
<a name="line29"></a>  }, true);
<a name="line30"></a>}
<a name="line31"></a>
<a name="line32"></a>startListening();
</pre>


</body>
</html>
